package cn.demoncat.util.lang.entity.report;

import java.math.BigDecimal;
import java.util.Objects;

/**
 * 统计 name -count
 * 
 * @author 延晓磊
 *
 * @since 2018年7月24日
 */
public class NameCount extends Count{

	protected String name;

	public NameCount() {
		super();
	}

	public NameCount(String name, long count, BigDecimal sum) {
		super(count,sum);
		this.name = name;
	}

	public NameCount(String name, long count) {
		super(count);
		this.name = name;
	}

	public NameCount(String name, BigDecimal sum) {
		super(sum);
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		if (!super.equals(o)) return false;
		NameCount nameCount = (NameCount) o;
		return Objects.equals(name, nameCount.name);
	}

	@Override
	public int hashCode() {
		return Objects.hash(super.hashCode(), name);
	}

	@Override
	public String toString() {
		return "NameCount{" +
				"name='" + name + '\'' +
				", count=" + count +
				", sum=" + sum +
				'}';
	}
}
